package study.spring.mail.simplemail;

import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;

import study.spring.mail.OrderManager;

public class OrderManagerImpl implements OrderManager {

	private MailSender mailSender;

	private SimpleMailMessage message;

	@Override
	public void sendMail() {
		String to="yaoming@gozap.com";
		SimpleMailMessage msg=new SimpleMailMessage(message);
		msg.setTo(to);
		msg.setText("Dear yaoming,thank you for placing order. your order number is 1");
		try {
			mailSender.send(msg);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public MailSender getMailSender() {
		return mailSender;
	}

	public void setMailSender(MailSender mailSender) {
		this.mailSender = mailSender;
	}

	public SimpleMailMessage getMessage() {
		return message;
	}

	public void setMessage(SimpleMailMessage message) {
		this.message = message;
	}

}
